<!doctype html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<link href="../../css/mui.min.css" rel="stylesheet" />
		<link rel="stylesheet" href="../../css/allApp.css" />
		<link rel="stylesheet" href="css/css.css" />
		<style type="text/css">
			.title {
				margin: 0;
			}
			
			.xj-content .mui-card-content {
				padding: 2px 2px 14px 2px;
			}
		</style>
	</head>

	<body>
		<header class="mui-bar mui-bar-nav">
			<a class="mui-action-back mui-icon mui-icon-left-nav mui-pull-left"></a>
			<h1 class="mui-title">现场巡检</h1>
		</header>
		<div class="mui-content">
			<div class="xj-content" id="yulan">
				<div class="H-10">
				</div>
				<!--<div class="mui-card">-->
				<!--页眉，放置标题-->
				<!--<div class="mui-card-header">
						<div class="mui-left title">
							 风机机位状况
						</div>
						<div class="mui-right mui-right-title">
							状态：<span>正常</span>
						</div>
					</div>-->
				<!--内容区-->
				<!--<div class="mui-card-content">
						<p>备注：表面无裂纹、无进水和积水、无塌陷</p>
						<div class="img-up">
							<img src="./img/img.png" alt="" data-preview-src="" />
						</div>
					</div>
				</div>-->
				<!--<div class="mui-card">-->
				<!--页眉，放置标题-->
				<!--<div class="mui-card-header">
						<div class="mui-left">
							1 风机机位状况
						</div>
						<div class="mui-right mui-right-title">
							状态：<span class="FtHs">异常</span>
						</div>
					</div>-->
				<!--内容区-->
				<!--<div class="mui-card-content">
						<p>备注：表面无裂纹、无进水和积水、无塌陷</p>
						<div class="img-up">
							<img src="./img/img.png" alt="" />
						</div>
					</div>
				</div>-->

			</div>
		</div>
		<div class="btn">
			<button type="button" class="mui-btn mui-btn-primary mui-col-sm-12 mui-col-xs-12" id="submit">提交</button>
		</div>
		<script src="../../js/mui.min.js"></script>
		<script type="text/javascript" src="../../js/mkeyplus.base.xunjian.js"></script>
		<script type="text/javascript" src="../../js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="../../js/common.js"></script>
		<script src="./js/mui.previewimage.js"></script>
		<script src="./js/mui.zoom.js"></script>
		<script type="text/javascript" src="../../js/uuid.js"></script>
		<script type="text/javascript" src="./js/img-up.js"></script>
		<script type="text/javascript">
			mui.init();
			mui.previewImage();

			mui.plusReady(function() {

				var self = plus.webview.currentWebview();
				var xjlbid = self.xjlbid;
				var rate = self.rate;
				var smTime = self.smTime;
				var shebeibh = self.shebeibh;
				var opener = self.opener();
				userxjId = self.userxjId
				//			alert(_id);
				//				var btn_state = self.btn_state;
				ajaxFunwei();

				function ajaxFunwei() {
					var save = JSON.parse(localStorage.getItem("savexcxj"));
					for(var i = 0; i < save.length; i++) {
						if(xjlbid == save[i].userxjId) {
							var jcx = save[i].jcxArray;
							console.log('shuzu---' + JSON.stringify(jcx));
							for(var j = 0; j < jcx.length; j++) {
								//								alert(jcx[j].Title);
								var str = "";
								str += '<div class="mui-card"data-id="' + jcx[j].id + '">';
								
								if(jcx[j].state == "异常") {
									str += '<div class="mui-card-header"><div class="mui-left title">' + jcx[j].Title + '</div><div class="mui-right mui-right-title">状态：<span class="FtHs state">' + jcx[j].state + '</span></div></div>';
								} else {
									str += '<div class="mui-card-header"><div class="mui-left title">' + jcx[j].Title + '</div><div class="mui-right mui-right-title">状态：<span class="state">' + jcx[j].state + '</span></div></div>';
								}
								str += '<div class="mui-card-content"><p>备注：<span class="beizhu">' + jcx[j].desc + '</span><span class="hide else">暂无备注</span></p><div class="img-up"><img src="' + jcx[j].attach + '" alt="" data-preview-src="" data-preview-group="' + (j + 1) + '"/></div></div>';
								str += '</div>';
								$(".xj-content").append(str);
							}

						}
					}
					
					alert();
					style_();

				}
				

						document.querySelector('#submit').addEventListener('tap', function() {
							if (plus.networkinfo.getCurrentType()  ==  plus.networkinfo.CONNECTION_NONE)  {
							mui.toast('当前无网络，无法提交')
							} else {
						up();
					}
						})
					
				function alert(){
					$(".mui-card-header").on("tap", ".title", function() {
						var Text = $(this).text()
						mui.alert(Text, '巡检项名称', function() {});
					})
				}
				//				图片上传
				function up() {
					var list = $('#yulan .mui-card');
					var n = 0;
					//					console.log('jcx-----:' + JSON.stringify(jcx));
					for(var m = 0; m < list.length; m++) {
						var src = $(list[m]).find('img').attr('src');
						//						alert(src);
						if(src == undefined || src == '') {
							n++;
						}
					}
					var length = list.length - n;
					var src ;
					if(n == list.length) {
						tijiao();
					} else {
						for(var i = 0; i < list.length; i++) {
							src = $(list[i]).find('img').attr('src');

							if(src == "") {

							} else {
//								upload(src, i, length);
								upload(src, i, length);
							}

						}

					}

				}

			})
			//			判断图片和备注改变样式
			function style_() {
				var contentlist = $('.mui-card-content');
				for(var i = 0; i < contentlist.length; i++) {
					var img_src = $(contentlist[i]).find('img').attr('src');
					var beizhu = $(contentlist[i]).find('.beizhu').text();
					if(img_src == "") {
						$(contentlist[i]).find('.img-up').addClass('hide');
					}
					if(beizhu == "") {
						$(contentlist[i]).find('.beizhu').addClass('hide');
						$(contentlist[i]).find('.else').removeClass('hide');
					}
				}
			}
		</script>
	</body>

</html>